<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>上市公司营收预测模型分析报告</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            color: #333;
            background-color: #f8f9fa;
        }
        .header {
            background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
            color: white;
            padding: 40px 0;
            margin-bottom: 30px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }
        .header h1 {
            font-weight: 700;
            margin-bottom: 10px;
        }
        .section {
            background-color: white;
            border-radius: 10px;
            padding: 30px;
            margin-bottom: 30px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
            transition: transform 0.3s ease;
        }
        .section:hover {
            transform: translateY(-5px);
        }
        .section-title {
            color: #1a2a6c;
            border-bottom: 2px solid #b21f1f;
            padding-bottom: 10px;
            margin-bottom: 25px;
            font-weight: 600;
        }
        .card {
            border: none;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.05);
            margin-bottom: 20px;
            transition: transform 0.3s ease;
        }
        .card:hover {
            transform: translateY(-5px);
        }
        .card-header {
            background-color: #1a2a6c;
            color: white;
            border-radius: 10px 10px 0 0 !important;
            font-weight: 600;
        }
        .table {
            border-radius: 10px;
            overflow: hidden;
        }
        .table thead th {
            background-color: #1a2a6c;
            color: white;
            border: none;
        }
        .badge {
            font-size: 1em;
            padding: 8px 12px;
        }
        .chart-container {
            position: relative;
            height: 400px;
            margin: 20px 0;
        }
        .footer {
            background-color: #1a2a6c;
            color: white;
            padding: 20px 0;
            margin-top: 40px;
            text-align: center;
        }
        .model-card {
            height: 100%;
        }
        .best-model {
            border: 2px solid #28a745;
        }
        .feature-importance {
            margin-bottom: 20px;
        }
        .feature-importance .progress {
            height: 25px;
            margin-bottom: 10px;
        }
        .feature-name {
            font-weight: 600;
            margin-bottom: 5px;
        }
        .conclusion-item {
            margin-bottom: 15px;
            padding-left: 20px;
            position: relative;
        }
        .conclusion-item:before {
            content: "";
            position: absolute;
            left: 0;
            top: 8px;
            width: 10px;
            height: 10px;
            background-color: #b21f1f;
            border-radius: 50%;
        }
        .nav-pills .nav-link {
            color: #1a2a6c;
            font-weight: 500;
        }
        .nav-pills .nav-link.active {
            background-color: #1a2a6c;
        }
        .tab-content {
            padding: 20px 0;
        }
        .image-container {
            text-align: center;
            margin: 20px 0;
        }
        .image-container img {
            max-width: 100%;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        .image-caption {
            margin-top: 10px;
            font-style: italic;
            color: #666;
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="container">
            <h1><i class="bi bi-graph-up-arrow"></i> 上市公司营收预测模型分析报告</h1>
            <p class="lead">基于机器学习的上市公司营收预测与关键影响因素分析</p>
        </div>
    </div>

    <div class="container">
        <!-- 导航栏 -->
        <ul class="nav nav-pills mb-4" id="myTab" role="tablist">
            <li class="nav-item" role="presentation">
                <button class="nav-link active" id="overview-tab" data-bs-toggle="tab" data-bs-target="#overview" type="button" role="tab" aria-controls="overview" aria-selected="true">项目概述</button>
            </li>
            <li class="nav-item" role="presentation">
                <button class="nav-link" id="data-tab" data-bs-toggle="tab" data-bs-target="#data" type="button" role="tab" aria-controls="data" aria-selected="false">数据分析</button>
            </li>
            <li class="nav-item" role="presentation">
                <button class="nav-link" id="models-tab" data-bs-toggle="tab" data-bs-target="#models" type="button" role="tab" aria-controls="models" aria-selected="false">模型评估</button>
            </li>
            <li class="nav-item" role="presentation">
                <button class="nav-link" id="factors-tab" data-bs-toggle="tab" data-bs-target="#factors" type="button" role="tab" aria-controls="factors" aria-selected="false">关键因素</button>
            </li>
            <li class="nav-item" role="presentation">
                <button class="nav-link" id="conclusion-tab" data-bs-toggle="tab" data-bs-target="#conclusion" type="button" role="tab" aria-controls="conclusion" aria-selected="false">结论建议</button>
            </li>
        </ul>

        <div class="tab-content" id="myTabContent">
            <!-- 项目概述 -->
            <div class="tab-pane fade show active" id="overview" role="tabpanel" aria-labelledby="overview-tab">
                <div class="section">
                    <h2 class="section-title"><i class="bi bi-info-circle"></i> 项目概述</h2>
                    <div class="row">
                        <div class="col-md-6">
                            <h4>案例介绍</h4>
                            <p>在金融领域，上市公司营收预测非常重要，因为它直接反映了公司的运营情况和未来发展趋势。投资者和金融数据分析师通常关注上市公司营收预测，以评估公司业绩表现和投资潜力。</p>
                            
                            <h4>实战目标</h4>
                            <p>建立上市公司营收预测模型，评价模型的性能，探索影响上市公司营收的关键因素。</p>
                        </div>
                        <div class="col-md-6">
                            <h4>数据概览</h4>
                            <ul>
                                <li>样本数量: <span class="badge bg-primary">4996</span></li>
                                <li>特征数量: <span class="badge bg-primary">12</span></li>
                                <li>模型数量: <span class="badge bg-primary">4</span></li>
                                <li>最佳模型: <span class="badge bg-success">Lasso回归</span></li>
                            </ul>
                            
                            <h4>主要特征</h4>
                            <ul>
                                <li>营业收入</li>
                                <li>营业成本</li>
                                <li>资产总计</li>
                                <li>负债合计</li>
                                <li>经营活动产生的现金流量净额</li>
                                <li>投资活动产生的现金流量净额</li>
                                <li>筹资活动产生的现金流量净额</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 数据分析 -->
            <div class="tab-pane fade" id="data" role="tabpanel" aria-labelledby="data-tab">
                <div class="section">
                    <h2 class="section-title"><i class="bi bi-database"></i> 数据分析</h2>
                    
                    <h4>数据预处理</h4>
                    <p>本次实战使用的数据集包含4996个样本和12个特征。数据预处理步骤包括：</p>
                    <ul>
                        <li>检查并处理缺失值</li>
                        <li>检查数据类型</li>
                        <li>基本统计分析</li>
                    </ul>
                    
                    <h4>数据可视化</h4>
                    <div class="row">
                        <div class="col-md-6">
                            <div class="image-container">
                                <img src="特征分布直方图.png" alt="特征分布直方图">
                                <p class="image-caption">特征分布直方图</p>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="image-container">
                                <img src="特征箱线图.png" alt="特征箱线图">
                                <p class="image-caption">特征箱线图</p>
                            </div>
                        </div>
                    </div>
                    
                    <div class="image-container">
                        <img src="相关性热力图.png" alt="相关性热力图">
                        <p class="image-caption">特征相关性热力图</p>
                    </div>
                </div>
            </div>

            <!-- 模型评估 -->
            <div class="tab-pane fade" id="models" role="tabpanel" aria-labelledby="models-tab">
                <div class="section">
                    <h2 class="section-title"><i class="bi bi-cpu"></i> 模型评估</h2>
                    
                    <h4>模型性能比较</h4>
                    <div class="table-responsive">
                        <table class="table table-striped table-hover">
                            <thead>
                                <tr>
                                    <th>模型</th>
                                    <th>训练集 R²</th>
                                    <th>测试集 R²</th>
                                    <th>测试集 RMSE</th>
                                    <th>测试集 MAE</th>
                                    <th>交叉验证 R²</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>线性回归</td>
                                    <td>0.9995</td>
                                    <td>0.9992</td>
                                    <td>112408105.8964</td>
                                    <td>15381306.3506</td>
                                    <td>-6166.9891</td>
                                </tr>
                                <tr>
                                    <td>岭回归</td>
                                    <td>0.9994</td>
                                    <td>0.9985</td>
                                    <td>152358710.7881</td>
                                    <td>22771977.9418</td>
                                    <td>0.9986</td>
                                </tr>
                                <tr class="table-success">
                                    <td><strong>Lasso回归</strong></td>
                                    <td><strong>0.9995</strong></td>
                                    <td><strong>0.9992</strong></td>
                                    <td><strong>110688497.8719</strong></td>
                                    <td><strong>15339250.6883</strong></td>
                                    <td><strong>0.9991</strong></td>
                                </tr>
                                <tr>
                                    <td>随机森林</td>
                                    <td>0.9128</td>
                                    <td>-0.1378</td>
                                    <td>4257307407.4803</td>
                                    <td>460479242.6811</td>
                                    <td>0.3398</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    
                    <h4>模型可视化比较</h4>
                    <div class="image-container">
                        <img src="模型比较.png" alt="模型比较">
                        <p class="image-caption">不同模型性能比较</p>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="image-container">
                                <img src="预测值与实际值对比图.png" alt="预测值与实际值对比图">
                                <p class="image-caption">预测值与实际值对比图</p>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="image-container">
                                <img src="残差图.png" alt="残差图">
                                <p class="image-caption">残差图</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 关键因素 -->
            <div class="tab-pane fade" id="factors" role="tabpanel" aria-labelledby="factors-tab">
                <div class="section">
                    <h2 class="section-title"><i class="bi bi-bar-chart"></i> 关键影响因素</h2>
                    
                    <h4>特征重要性分析</h4>
                    <div class="image-container">
                        <img src="特征重要性.png" alt="特征重要性">
                        <p class="image-caption">特征重要性分析</p>
                    </div>
                    
                    <div class="image-container">
                        <img src="Lasso回归_特征系数.png" alt="Lasso回归特征系数">
                        <p class="image-caption">Lasso回归特征系数</p>
                    </div>
                    
                    <h4>关键影响因素排名</h4>
                    <div class="table-responsive">
                        <table class="table table-striped table-hover">
                            <thead>
                                <tr>
                                    <th>排名</th>
                                    <th>特征</th>
                                    <th>重要性/系数</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>1</td>
                                    <td>经营活动产生的现金流量净额</td>
                                    <td>10054805053.3345</td>
                                </tr>
                                <tr>
                                    <td>2</td>
                                    <td>投资活动产生的现金流量净额</td>
                                    <td>6743334679.7093</td>
                                </tr>
                                <tr>
                                    <td>3</td>
                                    <td>筹资活动产生的现金流量净额</td>
                                    <td>4559405140.3289</td>
                                </tr>
                                <tr>
                                    <td>4</td>
                                    <td>所有者权益合计</td>
                                    <td>-92848897.6999</td>
                                </tr>
                                <tr>
                                    <td>5</td>
                                    <td>归属于母公司所有者权益合计</td>
                                    <td>42571840.0932</td>
                                </tr>
                                <tr>
                                    <td>6</td>
                                    <td>资产总计</td>
                                    <td>22955867.7422</td>
                                </tr>
                                <tr>
                                    <td>7</td>
                                    <td>负债合计</td>
                                    <td>17593243.7766</td>
                                </tr>
                                <tr>
                                    <td>8</td>
                                    <td>营业收入</td>
                                    <td>13131214.0611</td>
                                </tr>
                                <tr>
                                    <td>9</td>
                                    <td>营业成本</td>
                                    <td>-7297255.2409</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <!-- 结论建议 -->
            <div class="tab-pane fade" id="conclusion" role="tabpanel" aria-labelledby="conclusion-tab">
                <div class="section">
                    <h2 class="section-title"><i class="bi bi-lightbulb"></i> 结论与建议</h2>
                    
                    <h4>主要结论</h4>
                    <div class="conclusion-item">
                        <strong>模型性能：</strong>Lasso回归模型表现最佳，测试集R²达到0.9992，能够非常准确地预测上市公司营收。
                    </div>
                    <div class="conclusion-item">
                        <strong>关键因素：</strong>经营活动产生的现金流量净额是影响上市公司营收的最重要因素，其系数为10054805053.3345，远高于其他特征。其次是投资活动产生的现金流量净额和筹资活动产生的现金流量净额。这表明公司的现金流状况对营收有决定性影响。
                    </div>
                    
                    <h4>建议</h4>
                    <div class="row">
                        <div class="col-md-6">
                            <div class="card model-card">
                                <div class="card-header">
                                    <i class="bi bi-person-workspace"></i> 投资者与分析师建议
                                </div>
                                <div class="card-body">
                                    <ul>
                                        <li>重点关注上市公司的现金流状况，特别是经营活动产生的现金流量净额</li>
                                        <li>将现金流指标作为评估公司营收表现的重要参考</li>
                                        <li>在进行投资决策时，综合考虑公司的现金流状况和营收预测结果</li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card model-card">
                                <div class="card-header">
                                    <i class="bi bi-building"></i> 公司管理层建议
                                </div>
                                <div class="card-body">
                                    <ul>
                                        <li>优化现金流管理，提高经营活动的现金产生能力</li>
                                        <li>在进行营收预测时，充分考虑公司的现金流指标</li>
                                        <li>平衡投资、筹资和经营活动，以实现可持续的营收增长</li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <h4>未来研究方向</h4>
                    <div class="card">
                        <div class="card-body">
                            <ul>
                                <li>研究不同行业、不同规模公司的现金流与营收关系，建立更有针对性的预测模型</li>
                                <li>探索更多可能影响公司营收的因素，如宏观经济指标、行业发展趋势等</li>
                                <li>尝试使用更复杂的机器学习模型，如深度学习、集成学习等，进一步提高预测精度</li>
                                <li>建立动态预测模型，考虑时间序列因素，实现更精准的长期营收预测</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="footer">
        <div class="container">
            <p>&copy; 2023 上市公司营收预测模型分析报告 | 基于机器学习的金融数据分析</p>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 添加页面加载动画
        document.addEventListener('DOMContentLoaded', function() {
            const sections = document.querySelectorAll('.section');
            sections.forEach((section, index) => {
                setTimeout(() => {
                    section.style.opacity = '0';
                    section.style.transform = 'translateY(20px)';
                    section.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
                    
                    setTimeout(() => {
                        section.style.opacity = '1';
                        section.style.transform = 'translateY(0)';
                    }, 100);
                }, index * 100);
            });
        });
    </script>
</body>
</html>